package com.hue.springcloud.controller;

import com.hue.springcloud.entites.CommonResult;
import com.hue.springcloud.entites.Payment;
import com.hue.springcloud.service.PaymentFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    @Autowired
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> paymentGet(@PathVariable("id") long id){
        return paymentFeignService.getPaymentById(id);
    }

    /*
        测试openfeign超时错误,openfeign默认等待时间为1s
     */
    @GetMapping("/consumer/payment/timeout")
    public String timeout(){
        return paymentFeignService.timeout();
    }
}
